<%@ page language="java" pageEncoding="UTF-8"%>
    <%
    	int currentPage = 1;
    	int pageCounter = 0;
    	try {
    		currentPage = Integer.parseInt(request.getParameter("currentPage"));
    		pageCounter = Integer.parseInt(request.getParameter("pageCounter"));
    	} catch(Exception e) {
    	}
    	String url = request.getParameter("url");
    	
    	if(currentPage > pageCounter) {
    		return ;
    	}
    	if(currentPage - 1 > 0) {
    %>
    	<a  style="font-size: small; " href="<%=request.getContextPath() %><%=url %>?currentPage=<%=(currentPage - 1) %>">上一页</a>
    <%	
    	}	
		if(currentPage < 6) {
			for(int j = 5; j >= 0; j --) {
				if(currentPage - j <= 0) {
					
				} else {
	%>
			<a  style="font-size: small; " href="<%=request.getContextPath() %><%=url %>?currentPage=<%=(currentPage - j) %>"><%=(currentPage - j) %></a>
	<%
				}
			}
			// 后五页
			for(int j = 1; j <= 5; j ++) {
				if(currentPage + j <= pageCounter) {
	%>
					<a  style="font-size: small; " href="<%=request.getContextPath() %><%=url %>?currentPage=<%=(currentPage + j) %>"><%=(currentPage + j) %></a>
	<%							
				}
			}
		
		} else {
		// 前五页
			for(int j = 5; j >= 0; j --) {
	%>
				<a  style="font-size: small; " href="<%=request.getContextPath() %><%=url %>?currentPage=<%=(currentPage - j) %>"><%=(currentPage - j) %></a>
	<%		
			}
	
			// 后五页
				for(int j = 1; j <= 5; j ++) {
					if(currentPage + j <= pageCounter) {
	%>
						<a  style="font-size: small; " href="<%=request.getContextPath() %><%=url %>?currentPage=<%=(currentPage + j) %>"><%=(currentPage + j) %></a>
	<%				
					}	
				}
		}
     %>
     <%
     	if(currentPage + 1 <= pageCounter) {
      %>
	     <a  style="font-size: small; " href="<%=request.getContextPath() %><%=url %>?currentPage=<%=(currentPage + 1) %>">下一页</a>
	 <%
	    }
	 %>
     <font color="red" style="font-size: small; color: red; ">&nbsp;&nbsp;&nbsp;&nbsp;当前：<%=currentPage %>/<%=pageCounter %></font>
